package nl.unimaas.games.tron.player;

import java.awt.Color;

import nl.unimaas.games.tron.engine.Board;
import nl.unimaas.games.tron.engine.Evaluator.VoronoiSpaceEvaluator;
import nl.unimaas.games.tron.player.mcts.Node;
import nl.unimaas.games.tron.player.mcts.SelectionStrategy;

@SuppressWarnings("serial")
/** Not used and not tested */
public class HeuristicUCTPlayer extends UCTPlayer {
	protected VoronoiSpaceEvaluator spacer = new VoronoiSpaceEvaluator();
	
	public HeuristicUCTPlayer(String name, int num, Color c) {
		super(name, num, c);
		select = new SelectionStrategy.HeuristicUCT(DEFAULT_C, DEFAULT_T);
		applyExpansionCutOff = true;
		//DEBUG = true;
	}
	
	@Override
	protected Node createNode(int player, Node parent, int move, Board b) {
		Node n = super.createNode(player, parent, move, b);
		if (move != Board.MOVE_NONE)
			n.tag = spacer.compute(b, player);
		else
			n.tag = 0d;
		return n;
	}
	
	@Override
	public HeuristicUCTPlayer clone() {
		HeuristicUCTPlayer player = new HeuristicUCTPlayer(getName(), getNumber(), getColor());
		player.select = select;
		player.finalMove = finalMove;
		player.cutOff = cutOff;
		player.applyExpansionCutOff = applyExpansionCutOff;
		player.applySimulationCutOff = applySimulationCutOff;
		player.applySpaceEstimation = applySpaceEstimation;
		player.playout = playout;
		player.spaceEval = spaceEval;
		player.description = description;
		player.spacer = spacer;
		return player;
	}
}
